// import axios from 'axios';
import axios, { url } from '.';
// 列表
export const getAll = async (data) => {
    // console.log(data);
    let res = await axios({
        method: "get",
        url: url + '/classify',
        params: data
    });
    return res.data;
}

export const getAllTypes = async () => {
    let res = await axios({
        method: "get",
        url: url + "/classify/all"
    })
    return res.data;
}
// 增加
export const add = async (data) => {
    let res = await axios({
        method: "post",
        url: url + '/classify',
        data
    });

    return res.data;
}
// 验证
export const exist = async (data) => {
    let res = await axios({
        method: "post",
        url: url + '/classify/classifyExist',
        data
    });

    return res.data;
}
// 删除
export const delete1 = async (id) => {
    let res = await axios({
        method: "delete",
        url: url + '/classify/' + id,
    });
    return res.data;
}
// 修改搜索
export const getById = async (id) => {
    let res = await axios({
        method: "get",
        url: url + '/classify/' + id,
    });
    return res.data;
}
// 修改
export const update = async (data) => {
    let res = await axios({
        method: "put",
        url: url + '/classify/' + data._id,
        data
    });
    return res.data;
}